


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="/static/index/js/jquery.min.js"></script>
            <script src="/static/index/js/toastr.min.js"></script>
            <link href="/static/admin/css/toastr.min.css" rel="stylesheet"/>
    <title>Document</title>
    {css href="/static/mobile/css/bootstrap/bootstrap.min.css"}
    {css href="/static/mobile/css/login/login.css"}
    {css href="/static/mobile/js/jquery/jquery.min.js"}
    {css href="/static/mobile/js/bootstrap/bootstrap.min.js"}
</head>
<body>
<div class="container">
    <div class="row row1">

        <div class="pull-left pull-pos"><a href="{:url('mobile/Index/index')}" class="text-qx"><h4>取消</h4></a></div>

        <div class="center-block text-center"><h3 style="color:#42BD56;"><strong>登录ShowMovie</strong></h3></div>
    </div>
    <div class="col-xs-12">
            <div class="form-group form-group-lg" style="margin-top: 30px;">
                <div class="col-sm-12">
                    <input class="form-control" id="phone" type="text" name="phone" placeholder="请输入手机号">
                    <span class="yanzheng"></span>
                </div>
            </div>
            <div class="form-group form-group-lg">
                <div class="col-xs-7">
                    <input type="text" class="form-control" id="code" name="code" placeholder="验证码">
                </div>

                <button class="btn btn-success btn-lg em" id="getphone">获取验证码</button>
            </div>
            <div class="form-group form-group-lg">
                <div class="col-sm-12">
                    <button class="btn btn-success btn-lg btn-block mobile-log">登录</button>
                </div>
            </div>
        <script>
            $(function(){
                $('#getphone').click(function(){
                	if ($('#phone').val()) {
                    var second = 60;
                    time();
                    var timer = setInterval(time,1000); 
                    function time(){
                                    // var jj = document.getElementById('em');
                                    if (second == 0) { 
                                        $('.em')[0]['disabled'] = false;
                                        //obj.removeattr("disabled"); 
                                        $('.em').html("获取验证码");
                                        return;
                                    } else { 
                                        $('.em')[0]['disabled'] = true;
                                        // $('.em').attr("disable",false); 
                                        $('.em').html("重新发送(" + second + ")");
                                        second--; 
                                    } 
                                }
                                }else{
                                	$('.yanzheng').html("请填写手机号");
					    			$('.yanzheng').css("color",'red');
                                }

                    $phone = document.getElementById('phone').value;
                    // console.log($phone);
                    $.ajax({
                        type: 'post',
                        url: '{:url("mobile/Send/sendmobilemsg")}',
                        data: 'phone='+$phone,
                        dataType: 'json',
                        success: function (data) {
                            toastr.success('短信发送成功(▰˘◡˘▰)');
                        }
                    });
                    
                });
                $('.mobile-log').click(function (){
                    mobilelog();
                });
                function mobilelog(){
                    $.ajax({
                        type: 'post',
                        url: '/mobile/Login/smslogin',
                        data: {
                            phone : $('#phone').val(),
                            code : $('#code').val()
                        },
                        dataType: 'json',
                        success: function (data) {
                           if (data) {
                                toastr.success('登录成功,拼命加载ing╭(●｀∀´●)╯╰(●’◡’●)╮ (●’◡’●)ﾉ ヾ(*´▽‘*)ﾉ');
                                setInterval(function(){
                                        location.href='http://47.96.69.12/mobile/index/index';
                                    }, 1000);
                                } else {
                                    toastr.error('登录失败,请检查登录账号和密码(▰˘◡˘▰)');
                                }
                        },
                        error: function () {
                            alert('AJAX操作失败');
                        }
                    });
                }
            });
        </script>
        <div class="form-group form-group-lg">
            <div class="col-sm-12" style="text-align:center;">
                <a href="{:url('mobile/Login/index')}">手机不在？换邮箱</a>
            </div>
        </div>
    </div>
</div>
</body>
</html>
